/* GUI CONVERTED from rssupve.p (converter v1.75) Sat Aug 12 23:16:58 2000 */
/* rssupve.p - Supplier Performance Supplier Schedules Missed Shipments     */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                      */
/* All rights reserved worldwide.  This is an unpublished work.             */
/*F0PN*/ /*V8:ConvertMode=Maintenance                                       */
/*N014*/ /*V8:RunMode=Character,Windows                                     */
/* REVISION 8.6E        CREATED: 08/17/98      BY: *L060* Steve Nugent      */
/* REVISION 8.6E  LAST MODIFIED: 09/15/98      BY: *K1WX* Steve Nugent      */
/* REVISION 9.1   LAST MODIFIED: 10/01/99      BY: *N014* Patti Gaultney    */
/* REVISION 8.6   LAST MODIFIED: 04/21/00      BY: *K25S* Patrick Rowan     */
/* REVISION 9.1   LAST MODIFIED: 08/12/00      BY: *N0KP* myb               */




/*                                                                          */
/* -----  W A R N I N G  -----  W A R N I N G  -----  W A R N I N G  -----  */
/*                                                                          */
/*         THIS PROGRAM IS A BOLT-ON TO STANDARD PRODUCT MFG/PRO.           */
/* ANY CHANGES TO THIS PROGRAM MUST BE PLACED ON A SEPARATE ECO THAN        */
/* STANDARD PRODUCT CHANGES.  FAILURE TO DO THIS CAUSES THE BOLT-ON CODE TO */
/* BE COMBINED WITH STANDARD PRODUCT AND RESULTS IN PATCH DELIVERY FAILURES.*/
/*                                                                          */
/* -----  W A R N I N G  -----  W A R N I N G  -----  W A R N I N G  -----  */
/*                                                                          */



 {mfdeclre.i}

         define input parameter   schd_recid      as recid no-undo.

         define       variable    vep_recid       as recid no-undo.
         define       variable    vepd_recid      as recid no-undo.
         define       variable    ver_recid       as recid no-undo.
         define       variable    category        like vec_category no-undo.
         define       variable    commcode        like ver_comm_code no-undo.
         define       variable    v_db            like vep_db no-undo.
         define       variable    qty_open        like pod_qty_ord no-undo.

         for first schd_det where schd_recid = recid(schd_det):
         end.

         for first scx_ref where
/*K25S*/     scx_type  = 2            and   /* 1 = SO, 2 = PO */
             scx_order = schd_nbr     and
             scx_line  = schd_line:
         end.

         if schd_date < today then do:

         for first vef_ctrl:
         end.

         category = vef_po_receipts.

        /* FIND COMMODITY CODE IF IT EXISTS */


         for first qad_wkfl where
             qad_key1 = "comd_det"  and
             qad_key2 = scx_part no-lock:
         end.
         if available (qad_wkfl) then
             assign
                 commcode = qad_key3.
         else
             assign
                 commcode = "".

        /* FIND DB NUMBER IF IT EXISTS FOR THIS VENDOR */

            assign v_db = "".

            for first po_mstr where
                    po_nbr = scx_order no-lock:
            end.

            if available (po_mstr) then do:
                for first qad_wkfl where
                    qad_key1 = "vd_mstr_ve" and
                    qad_key2 = po_vend no-lock:
                end.

                if available (qad_wkfl) then
                    assign
                        v_db = qad_charfld[2].
            end.  /* END - if available (po_mstr) */


        /* FIND STOCKING UNIT OF MEASURE */

         for first pt_mstr where
                pt_part = scx_part no-lock:
         end.


        /* FIND SUBCONTRACT TYPE */

         for first pod_det where
                pod_nbr = scx_po and
                pod_line = scx_line no-lock:
         end.



        /* CHECK TO SEE IF SUPPLIER FOR THIS SCHEDULE IS REGISTERED FOR
            SUPPLIER PERFORMANCE */

         {gprun.i ""pove.p""
             "(input scx_shipfrom,
               input ""1"",
               input scx_shipto,
               input scx_part,
               input commcode,
               input category,
               output ver_recid)"}
/*GUI*/ if global-beam-me-up then undo, leave.


         for first ver_mstr where ver_recid = recid(ver_mstr):
         end.

         if not available ver_mstr then return.

/*K1WX*/ qty_open = schd_cum_qty - pod_cum_qty[1].

         /* IF RECEIPT QUALIFIES, THEN CREATE vep_mstr RECORD */

/*K1WX*/ /* ADDED qty_open AND SUPPLIER SCHEDULE TIME TO THE povep.p CALL */
/*N014*/ /* ADDED BLANK SUBACCOUNT AS 12TH PARAMETER           */
/*K25S*/ /* ADDED pod_cum_qty[1] & schd_cum_qty TO END OF INPUT LIST      */

                   {gprun.i ""povep.p""
                        "(input  scx_shipfrom,
                        input  ""1"",
                        input  """",
                        input  """",
                        input  schd_nbr,
                        input  """",
                        input  schd_line,
                        input  """",
                        input  scx_part,
                        input  pt_um,
                        input  """",
                        input  """",
                        input  """",
                        input  schd_date,
                        input  scx_shipto,
                        input  """",
                        input  """",
                        input  schd_discr_qty,
                        input  qty_open,
                        input  """",
                        input  """",
                        input  """",
                        input  """",
                        input  """",
                        input  """",
                        input  commcode,
                        input  """",
                        input  """",
                        input  """",
                        input  """",
                        input  schd_reference,
                        input  """",
                        input  """",
                        input  """",
                        input  """",
                        input  """",
                        input  """",
                        input  pod_sched,
                        input  v_db,
                        input  pod__qad16,
                        input  ""yes"",
                        input  """",
                        input  schd_time,
                        input  pod_cum_qty[1],
                        input  schd_cum_qty,
                        output  vep_recid)"}
/*GUI*/ if global-beam-me-up then undo, leave.



             /* CREATE MISSED SHIPMENT EVENT */

            {gprun.i ""povepd.p""
                      "(input  vep_recid,
                        input  """",
                        input  category,
                        input  vef_missed_ship,
                        input  """",
                        input  schd_discr_qty,
                        input  """",
                        input  """",
                        input  """",
                        input  ""yes"",
                        input  pt_um,
                        output vepd_recid)"}
/*GUI*/ if global-beam-me-up then undo, leave.


         end. /* if schd_date < today */
